html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  background-color: rgba(0, 0, 0, 0.5);
}

.container {
  margin: 100px auto;
  width: 300px;
  height: 150px;
  position: relative;
}

.container .item {
  width: 400px;
  height: 200px;
  display: flex;
  justify-self: center;
  align-items: center;
  position: absolute;
  top: 0;
  left: 0;
  transition: all 0.8s;
  box-shadow: 10px 10px 20px black;
}

.container .item img {
  display: block;
  width: 100%;
  object-fit: contain;
}

.container .item:nth-child(1) {
  margin-top: 100px;
  transform: rotateX(45deg) rotateY(-15deg) rotate(45deg);
  opacity: 0.8;
  z-index: 4;
}

.container .item:nth-child(1).active {
  transform: rotateX(0) rotateY(0) rotate(0) translateY(150px) scale(2);
  z-index: 9;
  top: 50%;
  margin-top: -100px;
  opacity: 1;
}

.container .item:nth-child(2) {
  margin-top: 200px;
  transform: rotateX(45deg) rotateY(-15deg) rotate(45deg);
  opacity: 0.8;
  z-index: 3;
}

.container .item:nth-child(2).active {
  transform: rotateX(0) rotateY(0) rotate(0) translateY(150px) scale(2);
  z-index: 9;
  top: 50%;
  margin-top: -100px;
  opacity: 1;
}

.container .item:nth-child(3) {
  margin-top: 300px;
  transform: rotateX(45deg) rotateY(-15deg) rotate(45deg);
  opacity: 0.8;
  z-index: 2;
}

.container .item:nth-child(3).active {
  transform: rotateX(0) rotateY(0) rotate(0) translateY(150px) scale(2);
  z-index: 9;
  top: 50%;
  margin-top: -100px;
  opacity: 1;
}

.container .item:nth-child(4) {
  margin-top: 400px;
  transform: rotateX(45deg) rotateY(-15deg) rotate(45deg);
  opacity: 0.8;
  z-index: 1;
}

.container .item:nth-child(4).active {
  transform: rotateX(0) rotateY(0) rotate(0) translateY(150px) scale(2);
  z-index: 9;
  top: 50%;
  margin-top: -100px;
  opacity: 1;
}
